package com.anxinr.service.impl;

import com.anxinr.mapper.ProjectMapper;
import com.anxinr.pojo.entity.Project;
import com.anxinr.service.IProjectService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author anxinr
 */
@Slf4j
@Service
public class IProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements IProjectService {

    @Override
    public IPage<Project> queryProject(Project project) {
        Page<Project> page = new Page<>(project.getPage(), project.getSize());
        LambdaQueryWrapper<Project> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(StringUtils.isNotBlank(project.getPname()),Project::getPname,project.getPname());
        wrapper.like(StringUtils.isNotBlank(project.getUser()),Project::getPname,project.getPname());
        Page<Project> projectPage = this.page(page, wrapper);
        log.info("返回信息->{}",projectPage);
        return projectPage;
    }
}
